<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>p4_居中测试</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .main {
            background-color: #ff0;
        }
        .card {
            width: 200px;
            height: 300px;
            background-color: pink;
            border: 3px solid red;
            margin: 0 auto;/*卡片在自己的版心居中*/
            text-align: center;/**/
            line-height: 300px;
        }
        .center {
            width: 500px;
            background-color: #0aa1ed;
            margin: 0 auto;
        }
    </style>
</head>
<body>
<!--最外层功能块-->
<div class="main">
    <!--版心-->
    <div class="center">
        <!--主要的展示内容-->
        <div class="card">我是内容</div>
        <div class="card">我是内容</div>
        <div class="card">我是内容</div>
        <div class="card">我是内容</div>
    </div>
</div>
</body>
</html>